package time

import "time"

const TimeLayoutFormat = "2006-01-02 15:04:05"

var timeUnitMapping = map[string]time.Duration{
	"秒钟": 1 * time.Second,
	"分钟": 1 * time.Minute,
	"小时": 1 * time.Hour,
	"天":  24 * time.Hour,
}

// GetTimeNumByMs get time unit num based on ms
func GetTimeNumByMs(code string) int64 {
	timeDuration, ok := timeUnitMapping[code]
	if ok {
		return timeDuration.Nanoseconds()
	}
	return 0
}
